<?php

namespace app\index\model;


define('UPLOAD_PATH',__DIR__.'/../../../public/upload/');

class File
{
    public static function uploadImg(\think\File $file)
    {
        $info = $file->validate(array(
            "ext" => "jpg,png",
        ))
            ->move(ROOT_PATH . 'public/upload');
        if ($info) {
            return UPLOAD_PATH.$info->getSaveName();
        }
        else {
            echoJson(0,$info->getError());
        }
    }

}